﻿$j = $.noConflict();
NBA = function(){
	var _getHtml = null;
	
	function _main(){
		//redirect
		gm.log(gm.url);
		if(/gameinfo\.html/.test(gm.url)){
			window.location = gm.url.replace('gameinfo.html', 'boxscore.html');
			return;
		}

/* 		// change sidebar links to boxscore.html
		$j.each( $j('div[id^="game-"]'), function(i, d){
			$j(d).click(function(e){
				e.stopPropagation();
				e.preventDefault();
				gm.log('/games/' + this.title + '/boxscore.html');
		    window.location = '/games/' + this.title + '/boxscore.html';
			});
		}); 
*/
		
	}

	return{
		version: '2008.2.2',
		// ---------------------------------------------------------------------------
		// 由此啟動
		// ---------------------------------------------------------------------------
		main: function(f, options){	// 注意: 不可直接傳入 GM_xmlhttpRequest, 會導致 permittion error
			gm.log('NBA v{0}', this.version);
			
			_getHtml = f;
			_main();
		}

	};
}();